<?php
namespace app\common\validate;

use think\Validate;

class WorkerValidate extends Validate
{
    protected $rule =   [
        'id'                         => 'require|integer',
        'user_id|用户ID'             => 'require|integer',
        'worker_today_id|今日人工ID' => 'require|integer',
        'worker_ids|人工ID'          => 'require',
        'page|页数'                  => 'require|integer',
        'limit|条数'                 => 'require|integer',
        'name|姓名'                  => 'require|length:1,50',
        'sex|性别'                   => 'require|in:1,2',
        'card_id|身份证号'           => 'require|length:1,20',
        'mobile|联系方式'            => 'require|length:1,20',
        'bank_code|银行卡号'         => 'require|length:1,50',
        'bank_name|开户银行'         => 'require|length:1,50',
        'card_img|身份证图片'        => 'require|length:1,255',
        'price|工费'                 => 'require|gt:0',
    ];
    
    protected $scene = [
        /** 接口 */
        'add'         => ['user_id', 'name', 'sex', 'card_id', 'mobile', 'bank_code', 'bank_name', 'card_img', 'face_img'],
        'list'        => ['user_id', 'page', 'limit'],
        'set_price'   => ['worker_today_id', 'price'],
        'to_today'    => ['user_id', 'worker_ids'],
        'list_search' => ['user_id', 'page', 'limit', 'cate_id'],
    ];
}